<?php
namespace app\home\model;
use think\Model;

class CourseSkuModel extends Model
{
	protected $table  = 'qm_course_sku';



	//课程，最低价格
	public function getCourseSkuLowestPriceInfo($course_id, $field = '*')
	{
		$info = $this->where('course_id', $course_id)->order('sell_money')->field($field)->find();
		return $info;
	}


	//找出某个课程，所有规格信息
	public function getCourseAllList($course_id, $field = '*')
	{
		$list = $this->where('course_id', $course_id)->order('id')->field($field)->select();
		if(!empty($list))
		{
			$list = $list->toArray();
		}
		return $list;
	}



	//课程-找出课程某个规格的价格信息
	public function getCourseSkuIdInfo($course_id, $sku_id)
	{
		$info = $this->where('course_id', $course_id)->where('id', $sku_id)->find();
		return $info;
	}



	//课程-某个条件查找SKU属性
	public function getCourseAndSpecsSkuInfo($course_id, $specs, $field = '*')
	{
		$info = $this->where('course_id', $course_id)->where('specs', $specs)->field($field)->find();
		return $info;
	}

}